<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
%>

<!--  修改父课程 2010-08-18 -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <base target="_self">
		<title>修改父课程</title>
	<link href="<%=path %>/css/index_css.css" rel="stylesheet" type="text/css" />
	<script language="javascript" src="<%=path %>/js/validate.js"></script>
	<script type="text/javascript">
        window.onload = function(){
        if('${requestScope.result}'=="true")
        {
          alert("修改成功！");
          window.returnValue="${requestScope.result}";
          window.close();
        }else if('${requestScope.result}'=="false")
        {
          alert("修改失败！");
          window.returnValue="${requestScope.result}";
          window.close();
        }
        }
        
         //获取中英文混合字符串的长度
		function strlen(str) {      
		    var len = 0;      
		    for (var i = 0; i < str.length; i++) {      
		        if (str.charCodeAt(i) > 255 || str.charCodeAt(i)<0) len += 2; else len ++;      
		    }      
		    return len;      
		}
	      
	     function checkForm()
	     {
	       var name=document.getElementById("name");
	       var description=document.getElementById("description");
	       if(name.value=="")
	       {
	         alert("学科名称不能为空！");
	         name.focus();
	         return false;
	       }
	       if(strlen(description.value)>100)
	       {
	         alert("备注字数过长！");
	         return false;
	       }
	       
	       document.courseForm.submit();
	     }
	   function checkAll(obj){
	   var checks= document.getElementsByName("gradeId");
	   	if(obj.checked){
	   		for(var i = 0; i<checks.length; i++) {
	   			checks[i].checked = true; 
	   		}
	   	}else {
	   		for(var i = 0; i<checks.length; i++) {
	   			checks[i].checked = false; 
	   		}
	   	}
	   }
	</script>

  </head>
  
  <body>
  <form action="<%=path %>/updateParentCourseCourseAction.action" method="post" name="courseForm">
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="25" align="left" valign="bottom" bgcolor="#ECE9D8" class="f_8"><table width="100%"><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;注：<span class="f_11">*</span>为必填项</td><td align="right">&nbsp;</td></tr></table></td>
  </tr>
  <tr>
    <td height="12" align="center" valign="middle" bgcolor="#ECE9D8">
    <table width="95%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="1" bgcolor="#ABA899"></td>
      </tr>
      <tr>
        <td height="1" bgcolor="#FFFFFF"></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="25" align="center" valign="top" bgcolor="#ECE9D8">
    <table width="93%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="30%" height="30" align="right" class="f_6" nowrap="nowrap">学科编号：</td>
        <td width="70%" align="left">${courseById.courseId }
          <input type="hidden" value="${courseById.courseId }" name="course.courseId" id="courseId" />
        </td>
      </tr>
      <tr>
        <td width="30%" height="30" align="right" class="f_6" nowrap="nowrap"><span class="f_11">* </span>学科名称：</td>
        <td width="70%" align="left"><input type="text" name="course.name" id="name" value="${courseById.name }" maxlength="25"/></td>
      </tr>
      <tr>
        <td height="30" align="right" class="f_6">序号：</td>
        <td align="left"><input type="text" name="course.sort" value="${courseById.sort }" /></td>
      </tr>
      <tr>
        <td height="30" align="right" valign="top" class="f_6">适用年级：</td>
        <td align="left" valign="top">
         <table width="400" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="left" valign="top" class="tb_10 border_2">
             <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <c:choose>
                <c:when test="${! empty gradeList}">
                  <c:set value="1" var="i" />
                  <input type="checkbox" onclick="checkAll(this)"/>全选/全不选
                  <c:forEach items="${gradeList}" var="grade">
              		<tr>
                    <td height="25" align="left"><input type="checkbox" name="gradeId" value="${grade.gradeId }" ${requestScope.map[grade.gradeId] } />${grade.name }</td>
                    <td align="left">&nbsp;</td>
                    <!--<c:if test="${i%4==0}">
                      </tr><tr>
                    <c:set value="${i+1}" var="i" />
                    </c:if>-->
             		</tr>
                  </c:forEach>
                </c:when>
                <c:otherwise><td><font color="#CCCCCC">无年级信息</font></td></c:otherwise>
              </c:choose>
            </table></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td height="5" colspan="2" align="right" valign="top" class="f_6">&nbsp;</td>
      </tr>
      <tr>
        <td height="30" align="right" valign="top" class="f_6">描述：</td>
        <td align="left" valign="top"><textarea name="course.description" id="description" cols="50" rows="5">${courseById.description }</textarea></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="25" align="center" valign="middle" bgcolor="#ECE9D8">
     <table width="95%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="1" bgcolor="#ECE9D8"></td>
      </tr>
      <tr>
        <td height="1" bgcolor="#ECE9D8"><br></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="25" align="center" valign="middle" bgcolor="#ECE9D8"><input type="button" onclick="checkForm();" name="Submit" value="提 交" /></td>
  </tr>
</table>
</form>
  </body>
</html>
